package edu.mju.controller;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 *  首页我的订单
 * @Author:wyp
 * @Date:2020/5/30 16:11
 */
@WebServlet("/myOrder")
public class myOrderController extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String user = (String) req.getSession().getAttribute("user");
        System.out.println("user:"+user);
        if(user==null){
            resp.setContentType("text/html;charSet=GBK");
            PrintWriter out = resp.getWriter();
            out.print("<script>alert('您还未登陆，无法查看！请登陆后再试！'); window.location='./login' </script>");
            out.flush();
            out.close();
        }
        req.getRequestDispatcher("/WEB-INF/view/myOrder.jsp").forward(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }
}
